package com.xuecheng.checkcode.interfaces.web;

import com.xuecheng.checkcode.application.service.CodeApplication;
import com.xuecheng.checkcode.domain.model.vo.req.CheckCodeQry;
import com.xuecheng.checkcode.domain.model.vo.req.CheckCodeVerifyQry;
import com.xuecheng.checkcode.domain.model.vo.resp.CheckCodeResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: LiJunXi
 * @Description:
 * @Date: 2024-09-07  18:05
 */
@Api(value = "验证码服务接口")
@RestController
public class CheckCodeApi {

    @Autowired
    private CodeApplication codeApplication;

    @ApiOperation("生成验证码")
    @PostMapping("/pic")
    public CheckCodeResp generateCheckCode(CheckCodeQry checkCodeQry){
        return codeApplication.generateCheckCode(checkCodeQry);
    }

    @ApiOperation("验证验证码")
    @PostMapping("/verify")
    public Boolean verify(@RequestBody CheckCodeVerifyQry checkCodeVerifyQry){
        return codeApplication.verify(checkCodeVerifyQry);
    }
}
